package edu.hunan.cxb18.error.impl;

import edu.hunan.cxb18.error.CommonError;

/**
 * @author AuthorName
 * @create 2020-04-23 13:08
 */
public class UserException extends Exception implements CommonError {
    private CommonError commonError;
    //直接通过传参，用户构造业务异常
    public UserException(CommonError commonError) {
        super();
        this.commonError = commonError;
    }
    //自定义异常
    public UserException (CommonError commonError,String errMsg){
        super();
        this.commonError = commonError;
        this.commonError.setErrMsg(errMsg);
    }
    @Override
    public int getErrCode() {
        return this.commonError.getErrCode();
    }

    @Override
    public String getErrMsg() {
        return this.commonError.getErrMsg();
    }

    @Override
    public CommonError setErrMsg(String errMsg) {
        this.commonError.getErrMsg();
        return this;
    }
}
